package com.example.shuiyin.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.example.shuiyin.enums.MediaType;
import com.example.shuiyin.enums.ProcessStatus;
import com.example.shuiyin.enums.ProcessType;
import com.example.shuiyin.enums.SourceType;
import com.example.shuiyin.converter.ProcessStatusConverter;
import com.example.shuiyin.converter.MediaTypeConverter;
import com.example.shuiyin.converter.SourceTypeConverter;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.Builder;

import java.time.LocalDateTime;

@Data
@TableName("process_records")
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ProcessRecord {
    @TableId(type = IdType.AUTO)
    private Long id;
    
    @TableField("user_id")
    private Long userId;
    
    @TableField("file_id")
    private String fileId;
    
    @TableField("file_name")
    private String fileName;
    
    @TableField(value = "process_type", typeHandler = MediaTypeConverter.class)
    private MediaType processType;
    
    @TableField(value = "status", typeHandler = ProcessStatusConverter.class)
    private ProcessStatus status;
    
    @TableField("create_time")
    private LocalDateTime createTime;
    
    @TableField("complete_time")
    private LocalDateTime completeTime;
    
    @TableField("result_file_id")
    private String resultFileId;
    
    @TableField("result_url")
    private String resultUrl;
    
    @TableField("params")
    private String params;
    
    @TableField(value = "source_type", typeHandler = SourceTypeConverter.class)
    private SourceType sourceType;
    
    @TableField("source_url")
    private String sourceUrl;
    
    @TableField("original_filename")
    private String originalFilename;
    
    @TableField("media_type")
    private MediaType mediaType;
    
    @TableField("thumbnail_url")
    private String thumbnailUrl;
    
    private Integer duration;
    
    @TableField("error_message")
    private String errorMessage;
    
    @TableField("created_at")
    private LocalDateTime createdAt;
    
    @TableField("processed_at")
    private LocalDateTime processedAt;
    
    @TableField("updated_at")
    private LocalDateTime updatedAt;
    
    @TableField(exist = false)
    private User user;
} 